<template>
  <div class="search">
    <Card>
      <Row @keydown.enter.native="handleSearch">
        <Form
          ref="searchForm"
          :model="searchForm"
          inline
          :label-width="70"
          class="search-form"
        >
          <FormItem label="联系电话" prop="contactPhone">
            <Input
              type="text"
              v-model="searchForm.contactPhone"
              placeholder="请输入联系电话"
              clearable
              style="width: 180px"
            />
          </FormItem>
          <FormItem label="公司名称" prop="companyName">
            <Input
              type="text"
              v-model="searchForm.companyName"
              placeholder="请输入公司名称"
              clearable
              style="width: 180px"
            />
          </FormItem>

          <span style="margin-left: 35px" class="br">
            <Button @click="handleSearch" type="primary" icon="ios-search"
              >搜索</Button
            >
            <Button @click="handleReset">重置</Button>
            <Button @click="getDataList" icon="md-refresh">刷新</Button>
            <Button @click="addCargOwner" lang="" type="primary" icon="md-add"
              >新增承运人</Button
            >
          </span>
        </Form>
      </Row>
      <Row>
        <Table
          :loading="loading"
          border
          :columns="columns"
          :data="data"
          ref="table"
          sortable="custom"
        >
          <template slot-scope="{ row }" slot="action">
            <div style="display: flex">
              <div>
                <span style="color: #2d8cf0; cursor: pointer" @click="edit(row)"
                  >查看
                </span>
              </div>
              <div>
                <Dropdown transfer trigger="click" style="margin-left: 20px">
                  <a href="javascript:void(0)" style="display: inline-block">
                    更多
                    <Icon type="ios-arrow-down"></Icon>
                  </a>
                  <DropdownMenu slot="list">
                    <DropdownItem
                      style="color: red"
                      v-if="row.delFlag == 0"
                      @click.native="frozen(row)"
                      >禁用</DropdownItem
                    >
                    <DropdownItem
                      @click.native="Enable(row)"
                      v-if="row.delFlag == -1"
                      >启用</DropdownItem
                    >
                    <DropdownItem
                      v-if="row.grade == 2 && row.delFlag == 0"
                      @click.native="setDefault(row)"
                      >设置默认</DropdownItem
                    >
                    <DropdownItem @click.native="operationRecordClick(row)"
                      >操作记录</DropdownItem
                    >
                  </DropdownMenu>
                </Dropdown>
              </div>
            </div>
          </template>
        </Table>
      </Row>
      <Row type="flex" justify="end" class="page">
        <Page
          :current="searchForm.pageNumber"
          :total="total"
          :page-size="searchForm.pageSize"
          @on-change="changePage"
          @on-page-size-change="changePageSize"
          :page-size-opts="[10, 20, 50]"
          size="small"
          show-total
          show-elevator
          show-sizer
        ></Page>
      </Row>
    </Card>

    <Drawer
      :title="brawerTitle"
      :mask-closable="false"
      v-model="goodsVisible"
      width="700"
    >
      <div class="demo-spin-article">
        <Tabs @on-click="authenticationTabs" v-model="cargoName1">
          <TabPane label="营业执照" name="authenticationEnterprise">
            <div style="width: 100%; height: 15px"></div>
            <Form
              :model="companyLicenseForm"
              ref="companyLicenseForm"
              :rules="companyForm"
              :label-width="140"
              inline
            >
              <div style="margin-left: -57px">
                <div style="display: flex">
                  <div>
                    <FormItem label="公司名称" prop="companyName">
                      <Input
                        placeholder="请输入公司名称"
                        style="width: 205px"
                        v-model="companyLicenseForm.companyName"
                        clearable
                      />
                    </FormItem>
                  </div>
                  <div style="margin-left: 56px">
                    <FormItem label="统一社会信用代码" prop="certNo">
                      <Input
                        placeholder="请输入统一社会信用代码"
                        v-model="companyLicenseForm.certNo"
                        style="width: 150px"
                      />
                    </FormItem>
                  </div>
                </div>
                <FormItem label="公司类型" prop="type">
                  <Input
                    placeholder="请输入公司类型"
                    style="width: 205px"
                    v-model="companyLicenseForm.type"
                    clearable
                  />
                </FormItem>
                <FormItem label="注册地址" prop="street">
                  <Input
                    placeholder="请输入注册地址"
                    style="width: 205px"
                    v-model="companyLicenseForm.street"
                    clearable
                  />
                </FormItem>
                <div style="display: flex">
                  <div style="margin-left: 14px">
                    <FormItem label="法定代表人" prop="companyUserName">
                      <Input
                        style="width: 191px"
                        placeholder="请输入法定代表人"
                        v-model="companyLicenseForm.companyUserName"
                        clearable
                      />
                    </FormItem>
                  </div>
                  <div>
                    <FormItem label="注册电话" prop="companyPhone">
                      <Input
                        placeholder="请输入注册电话"
                        style="width: 205px"
                        v-model="companyLicenseForm.companyPhone"
                        clearable
                      />
                    </FormItem>
                  </div>
                </div>
                <div>
                  <FormItem
                    style="margin-left: -15px"
                    label="税源地"
                    prop="taxSource"
                  >
                    <Input
                      placeholder="请输入税源地"
                      style="width: 220px"
                      v-model="companyLicenseForm.taxSource"
                      clearable
                    />
                  </FormItem>

                  <div style="display: flex">
                    <div>
                      <FormItem
                        style="margin-left: -13px"
                        label="联系人"
                        prop="contactName"
                      >
                        <Input
                          style="width: 222px"
                          placeholder="请输入姓名"
                          v-model="companyLicenseForm.contactName"
                        />
                      </FormItem>
                    </div>
                    <div>
                      <FormItem
                        style="margin-left: 0px"
                        label="联系电话"
                        prop="contactPhone"
                      >
                        <Input
                          placeholder="请输入联系电话"
                          v-model="companyLicenseForm.contactPhone"
                          clearable
                          style="width: 203px"
                        />
                      </FormItem>
                    </div>
                  </div>
                </div>
              </div>
              <Row>
                <Col span="8">
                  <div
                    v-if="companyPicFileUrl"
                    style="
                      width: 148px;
                      height: 92px;
                      line-height: 75px;
                      margin-bottom: 7px;
                    "
                  >
                    <div class="demo-upload-list-company">
                      <img
                        v-if="companyPicFileUrl != ''"
                        style="width: 58px"
                        height="100px"
                        :src="companyPicFileUrl"
                      />
                      <img
                        style="width: 58px"
                        height="100px"
                        src="@/assets/vehicleAtes/owner3.png"
                      />
                      <div
                        v-if="companyPicFileUrl != ''"
                        class="demo-upload-list-company-cover"
                      >
                        <Icon
                          type="ios-eye-outline"
                          @click.stop="showPic(companyPicFileUrl)"
                        ></Icon>
                        <Icon
                          type="ios-trash-outline"
                          @click.stop="handleRemove(companyPicFileUrl, 1)"
                        ></Icon>
                      </div>
                    </div>
                  </div>
                  <Upload
                    class="Upload-border"
                    v-else
                    :on-progress="BusinessLicen"
                    :beforeUpload="beforeUpload"
                    ref="companyUpload"
                    :show-upload-list="false"
                    :on-success="handleSuccess"
                    :format="['jpg', 'jpeg', 'png']"
                    :on-format-error="handleFormatError"
                    :headers="header"
                    :data="{
                      fileType: 'IDCARD_FONT_PIC',
                      userId: idCardIdForms.userId,
                    }"
                    type="drag"
                    :action="upLoadCompanyLicense"
                    style="display: inline-block"
                  >
                    <div style="width: 148px; height: 92px; line-height: 75px">
                      <div class="demo-upload-list-company">
                        <img
                          v-if="companyPicFileUrl != ''"
                          style="width: 58px"
                          height="100px"
                          :src="companyPicFileUrl"
                        />
                        <img
                          style="width: 58px"
                          height="100px"
                          src="@/assets/vehicleAtes/owner3.png"
                        />
                        <div
                          v-if="companyPicFileUrl != ''"
                          class="demo-upload-list-company-cover"
                        >
                          <Icon
                            type="ios-eye-outline"
                            @click.stop="showPic(companyPicFileUrl)"
                          ></Icon>
                          <Icon
                            type="ios-trash-outline"
                            @click.stop="handleRemove(companyPicFileUrl, 1)"
                          ></Icon>
                        </div>
                      </div>
                    </div>
                  </Upload>
                  <div class="demo-uploadcss-compny">
                    <template>
                      <Progress
                        v-if="progressBusinessLicen"
                        text-inside
                        :percent="load"
                        :stroke-width="3"
                      ></Progress>
                    </template>
                  </div>
                  <div style="margin-top: 15px" class="check">
                    <span class="check_font">营业执照</span>
                  </div>
                </Col>
              </Row>
            </Form>
          </TabPane>

          <!-- <TabPane label="联系人" name="contactInformation">
            <div style="width: 100%; height: 15px">
              <Form
                :model="companyLicenseForm2"
                ref="companyLicenseForm2"
                :rules="companyForm2"
                :label-width="110"
                inline
              >
              
              </Form>
            </div>
          </TabPane> -->

          <TabPane label="银行信息" name="corporateInformation">
            <div style="width: 100%; height: 15px">
              <Form
                :model="companyLicenseForm3"
                ref="companyLicenseForm3"
                :rules="companyForm3"
                :label-width="110"
                inline
              >
                <div class="information-title">基本信息</div>
                <div style="margin-left: -30px">
                  <FormItem label="开户银行" prop="bankName">
                    <Input
                      style="width: 220px"
                      placeholder="请输入开户银行"
                      v-model="companyLicenseForm3.bankName"
                    />
                  </FormItem>
                  <FormItem
                    style="margin-left: 15px"
                    label="银行账号"
                    prop="bankCode"
                  >
                    <Input
                      placeholder="请输入银行账号"
                      v-model="companyLicenseForm3.bankCode"
                      clearable
                      style="width: 220px"
                    />
                  </FormItem>
                </div>

                <div class="information-title" style="margin-top: 20px">
                  配置信息
                </div>
                <div style="margin-left: -30px">
                  <FormItem
                    label="客户"
                    style="margin-left: -28px"
                    prop="clientId"
                  >
                    <Input
                      placeholder="请输入客户"
                      style="width: 248px"
                      v-model="companyLicenseForm3.clientId"
                      clearable
                    />
                  </FormItem>
                  <FormItem
                    label="操作员号"
                    style="margin-left: 14px"
                    prop="userId"
                  >
                    <Input
                      placeholder="请输入操作员号"
                      style="width: 220px"
                      v-model="companyLicenseForm3.userId"
                      clearable
                    />
                  </FormItem>

                  <FormItem
                    label="密码"
                    style="margin-left: -28px"
                    prop="userPswd"
                  >
                    <Input
                      placeholder="请输入密码"
                      style="width: 248px"
                      v-model="companyLicenseForm3.userPswd"
                      clearable
                    />
                  </FormItem>
                  <FormItem
                    label="账户"
                    style="margin-left: -12px"
                    prop="acntNo"
                  >
                    <Input
                      placeholder="请输入账户"
                      style="width: 245px"
                      v-model="companyLicenseForm3.acntNo"
                      clearable
                    />
                  </FormItem>
                  <FormItem
                    label="账户名"
                    style="margin-left: -14px"
                    prop="acntName"
                  >
                    <Input
                      placeholder="请输入账户名"
                      style="width: 234px"
                      v-model="companyLicenseForm3.acntName"
                      clearable
                    />
                  </FormItem>
                </div>
              </Form>
            </div>
          </TabPane>

          <TabPane label="经营许可证" name="PoweAttorney">
            <Form
              :model="companyLicenseForm4"
              ref="companyLicenseForm4"
              :rules="companyForm4"
              :label-width="175"
              inline
            >
              <div class="information-title">基本信息</div>
              <div style="margin-left: -12px; display: flex">
                <div>
                  <FormItem label="道路运输经营许可证号" prop="roadPermitNo">
                    <Input
                      placeholder="请输入道路运输经营许可证号"
                      style="width: 180px"
                      v-model="companyLicenseForm4.roadPermitNo"
                      clearable
                    />
                  </FormItem>
                </div>
                <div style="margin-left: -40px">
                  <FormItem label="许可证有效期" prop="roadPermitNoDate">
                    <DatePicker
                      type="date"
                      style="width: 170px"
                      format="yyyyMMdd"
                      placeholder="请选择许可证有效期"
                      :value="companyLicenseForm4.roadPermitNoDate"
                      @on-change="datePermitNoDate"
                    ></DatePicker>
                  </FormItem>
                </div>
              </div>

              <Row style="margin-left: -1px">
                <Col span="8">
                  <div
                    v-if="agreementUrl"
                    style="
                      width: 148px;
                      height: 92px;
                      line-height: 75px;
                      margin-bottom: 7px;
                    "
                  >
                    <div class="demo-upload-list-company">
                      <img
                        v-if="agreementUrl != ''"
                        style="width: 58px"
                        height="100px"
                        :src="agreementUrl"
                      />
                      <img
                        style="width: 58px"
                        height="100px"
                        src="@/assets/vehicleAtes/new2.png"
                      />
                      <div
                        v-if="agreementUrl != ''"
                        class="demo-upload-list-company-cover"
                      >
                        <Icon
                          type="ios-eye-outline"
                          @click.stop="showPic(agreementUrl)"
                        ></Icon>
                        <Icon
                          type="ios-trash-outline"
                          @click.stop="handleRemove(agreementUrl, 6)"
                        ></Icon>
                      </div>
                    </div>
                  </div>
                  <Upload
                    class="Upload-border"
                    v-else
                    :on-progress="AuthorizationAgreement"
                    :beforeUpload="beforeUpload"
                    ref="companyUpload"
                    :show-upload-list="false"
                    :on-success="handleSuccessAgreement"
                    :format="['jpg', 'jpeg', 'png']"
                    :on-format-error="handleFormatError"
                    :headers="header"
                    type="drag"
                    :action="uploadPic"
                    style="display: inline-block; width: 148px"
                  >
                    <div style="width: 148px; height: 92px; line-height: 75px">
                      <div class="demo-upload-list-company">
                        <img
                          v-if="agreementUrl != ''"
                          style="width: 58px"
                          height="100px"
                          :src="agreementUrl"
                        />
                        <img
                          style="width: 58px"
                          height="100px"
                          src="@/assets/vehicleAtes/new2.png"
                        />
                        <div
                          v-if="agreementUrl != ''"
                          class="demo-upload-list-company-cover"
                        >
                          <Icon
                            type="ios-eye-outline"
                            @click.stop="showPic(agreementUrl)"
                          ></Icon>
                          <Icon
                            type="ios-trash-outline"
                            @click.stop="handleRemove(agreementUrl, 6)"
                          ></Icon>
                        </div>
                      </div>
                    </div>
                  </Upload>
                  <div class="demo-uploadcss-compny">
                    <template>
                      <Progress
                        v-if="progressAgreement"
                        text-inside
                        :percent="load"
                        :stroke-width="3"
                      ></Progress>
                    </template>
                  </div>
                  <div style="margin-top: 15px" class="check">
                    <span class="check_font">经营许可证照片</span>
                  </div>
                </Col>
              </Row>
              <Row v-show="addOwnerShow">
                <Col>
                  <div style="margin-top: 22px"></div>
                </Col>
              </Row>
              <div class="information-title information-css">配置信息</div>
              <div style="width: 100%; height: 150px">
                <div style="margin-left: -12px; display: flex">
                  <div>
                    <FormItem
                      style="margin-left: -83px"
                      label="省厅账号"
                      prop="userName"
                    >
                      <Input
                        placeholder="请输入省厅账号"
                        style="width: 247px"
                        v-model="companyLicenseForm4.userName"
                        clearable
                      />
                    </FormItem>
                  </div>
                  <div style="margin-left: -71px">
                    <FormItem label="省厅密码" prop="password">
                      <Input
                        placeholder="请输入省厅密码"
                        style="width: 212px"
                        v-model="companyLicenseForm4.password"
                        clearable
                      />
                    </FormItem>
                  </div>
                </div>
                <div style="margin-left: -12px; display: flex">
                  <div>
                    <FormItem
                      style="margin-left: -41px"
                      label="iOSAppSecurity"
                      prop="iosAppKey"
                    >
                      <Input
                        placeholder="请输入iOS安全码"
                        style="width: 205px"
                        v-model="companyLicenseForm4.iosAppKey"
                        clearable
                      />
                    </FormItem>
                  </div>
                  <div style="margin-left: -3px">
                    <FormItem label="AndroidAppSecurity" prop="androidAppKey">
                      <Input
                        placeholder="请输入Android安全码"
                        style="width: 145px"
                        v-model="companyLicenseForm4.androidAppKey"
                        clearable
                      />
                    </FormItem>
                  </div>
                </div>
                <div style="margin-left: -40px"> 
                  <FormItem label="统一社会信用代码" prop="shengCertNo">
                    <Input
                      placeholder="请输入统一社会信用代码"
                      style="width: 220px"
                      v-model="companyLicenseForm4.shengCertNo"
                      clearable
                    />
                  </FormItem>
                </div>
              </div>
            </Form>
          </TabPane>

          <TabPane label="驾驶员发票" name="tax">
            <Form
              :model="companyLicenseForm6"
              ref="companyLicenseForm6"
              :rules="companyForm6"
              :label-width="110"
              inline
            >
              <FormItem
                style="margin-left: -18px"
                label="企业会员号"
                prop="enterpriseCode"
              >
                <Input
                  placeholder="请输入企业会员号"
                  style="width: 217px"
                  v-model="companyLicenseForm6.enterpriseCode"
                  clearable
                />
              </FormItem>

              <FormItem label="loginSecret" prop="enterpriseIdentity">
                <Input
                  placeholder="请输入loginSecret"
                  style="width: 220px"
                  v-model="companyLicenseForm6.enterpriseIdentity"
                  clearable
                />
              </FormItem>
              <FormItem
                label="loginKey"
                style="margin-left: -34px"
                prop="enterpriseKey"
              >
                <Input
                  placeholder="请输入loginKey"
                  style="width: 232px"
                  v-model="companyLicenseForm6.enterpriseKey"
                  clearable
                />
              </FormItem>
              <FormItem
                label="APPIdentity"
                style="margin-left: 5px"
                prop="appIdentity"
              >
                <Input
                  placeholder="请输入APPIdentity"
                  style="width: 215px"
                  v-model="companyLicenseForm6.appIdentity"
                  clearable
                />
              </FormItem>
              <FormItem label="APPKey" style="margin-left: -32px" prop="appKey">
                <Input
                  placeholder="请输入APPKey"
                  style="width: 230px"
                  v-model="companyLicenseForm6.appKey"
                  clearable
                />
              </FormItem>
            </Form>
          </TabPane>

          <TabPane label="ETC发票" name="ETCs">
            <Form
              :model="companyLicenseForm7"
              ref="companyLicenseForm7"
              :rules="companyForm7"
              :label-width="100"
              inline
            >
              <FormItem
                label="公司证件号"
                style="margin-left: -3px"
                prop="companyCertificate"
              >
                <Input
                  placeholder="请输入公司证件号"
                  style="width: 220px"
                  v-model="companyLicenseForm7.companyCertificate"
                  clearable
                />
              </FormItem>
              <FormItem
                label="公司编号"
                style="margin-left: 10px"
                prop="companyNumber"
              >
                <Input
                  placeholder="请输入公司编号"
                  style="width: 220px"
                  v-model="companyLicenseForm7.companyNumber"
                  clearable
                />
              </FormItem>

              <FormItem
                label="公钥"
                style="margin-left: -47px"
                prop="shiboPublicKey"
              >
                <Input
                  placeholder="请输入公钥"
                  style="width: 260px"
                  v-model="companyLicenseForm7.shiboPublicKey"
                  clearable
                />
              </FormItem>
              <FormItem
                label="私钥"
                style="margin-left: -10px"
                prop="shiboPrivateKey"
              >
                <Input
                  placeholder="请输入私钥"
                  style="width: 243px"
                  v-model="companyLicenseForm7.shiboPrivateKey"
                  clearable
                />
              </FormItem>
              <FormItem label="偏移量" style="margin-left: -33px" prop="iv">
                <Input
                  placeholder="请输入偏移量"
                  style="width: 250px"
                  v-model="companyLicenseForm7.iv"
                  clearable
                />
              </FormItem>
            </Form>
          </TabPane>
        </Tabs>
        <div class="demo-drawer-footers-company">
          <div style="display: flex; justify-content: space-between">
            <div></div>
            <!-- v-if="this.form.companyType == 2" -->
            <Button
              type="warning"
              @click="submitCompanyLicenseInfo"
              :loading="loadinLicenseInfo"
              >保存资料</Button
            >
          </div>
        </div>
        <Spin size="large" fix v-if="spinShow"></Spin>
      </div>
    </Drawer>

    <operationRecord
      @operationRecordEnd="operationRecordEnd"
      :operationRecordData="operationRecordData"
      :operationRecordModal="this.operationRecordModal"
    >
    </operationRecord>
  </div>
</template>

<script>
// 根据你的实际请求api.js位置路径修改
import {
  carryUserList,
  uploadPic,
  saveCarryUser,
  getCarryUser,
  setCarryUserGrade,
  disableEnable,
} from "@/api/index";
// 根据你的实际添加编辑组件位置路径修改
import { getStore } from "@/libs/storage";
import operationRecord from "@/views/componentsonn_source_goods/operationRecord";
import * as imageConversion from "image-conversion";
import {
  uploadIdCardPic,
  upLoadCompanyLicense,
  uploadHeadPortrait,
} from "@/api/index";
export default {
  name: "companyInfo",
  data() {
    return {
      uploadPic: uploadPic,
      uploadHeadPortrait: uploadHeadPortrait,
      auditFailedModal: false, // 审核不通过
      confirmRejection: "",
      AuditFailedInput: "",
      loadingbut: false,
      spinShow: false,

      enterpris: "",

      CorporateCard: "", //法人身份证
      OperatorAuthorization: "", //经办人授权协议

      UploadHandler: { key: "empty" },
      UploadLegalLersonIdCard: { key: "empty" },
      driverGroupId: { driverGroupId: "" }, //上传协议

      showDrawer: false, // 显示添加编辑抽屉
      loading: true, // 表单加载状态
      drop: false,
      header: {
        accessToken: getStore("accessToken"),
      },
      accessToken: getStore("accessToken"),
      dropDownIcon: "ios-arrow-down",
      searchForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
        sort: "createTime", // 默认排序字段
        order: "desc", // 默认排序方式
        contactPhone: "",
        companyName: "",
      },
      form: {},
      columns: [
        {
          title: "#",
          type: "index",
          width: 60,
        },
        {
          title: "等级",
          key: "mobile",
          minWidth: 100,
          render: (h, params) => {
            if (params.row.grade == 1) {
              return h("div", [
                h(
                  "Tag",
                  {
                    props: {
                      color: "green",
                    },
                  },
                  "主要"
                ),
              ]);
            } else if (params.row.grade == 2) {
              return h("div", [
                h(
                  "Tag",
                  {
                    props: {
                      color: "default", //orange
                    },
                  },
                  "普通"
                ),
              ]);
            } else {
              return h(
                "div",
                {
                  style: {
                    color: "#D0C4DE",
                  },
                },
                "未设置"
              );
            }
          },
        },
        {
          title: "状态",
          key: "status",
          // align: "center",
          sortable: false,
          width: 100,
          render: (h, params) => {
            if (params.row.delFlag == 0) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "success",
                    text: "启用",
                  },
                }),
              ]);
            } else if (params.row.delFlag == -1) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "error",
                    text: "禁用",
                  },
                }),
              ]);
            }
          },
          // filters: [
          //   {
          //     label: "启用",
          //     value: 0,
          //   },
          //   {
          //     label: "禁用",
          //     value: -1,
          //   },
          // ],
          filterMultiple: false,
          filterRemote: (e) => {
            let v = "";
            if (e.length > 0) {
              v = e[0];
            }
            this.searchForm.delFlag = v;
            this.searchForm.pageNumber = 1;
            this.getDataList();
          },
        },
        {
          title: "税源地",
          key: "taxSource",
          minWidth: 180,
          sortable: false,
          tooltip: true,
        },

        {
          title: "联系人",
          key: "contactName",
          minWidth: 100,
          sortable: false,
          tooltip: true,
        },
        {
          title: "联系电话",
          key: "companyPhone",
          minWidth: 140,
          sortable: false,
          render: (h, params) => {
            return h("div", params.row.contactPhone);
          },
        },
        {
          title: "公司名称",
          key: "companyName",
          minWidth: 220,
          tooltip: true,
        },
        {
          title: "统一社会信用代码",
          key: "certNo",
          minWidth: 200,
          tooltip: true,
        },

        {
          title: "法人",
          key: "companyUserName",
          minWidth: 100,
          sortable: false,
          tooltip: true,
        },
        {
          title: "开户银行",
          key: "bankName",
          minWidth: 200,
          tooltip: true,
        },
        {
          title: "银行账号",
          key: "bankCode",
          minWidth: 180,
          tooltip: true,
        },
        {
          title: "道路运输经营许可证号",
          key: "roadPermitNo",
          minWidth: 220,
          sortable: false,
        },
        {
          title: "许可证有效期",
          key: "roadPermitNoDate",
          minWidth: 180,
          sortable: false,
        },
        {
          title: "公司类型",
          key: "type",
          minWidth: 180,
          tooltip: true,
        },
        {
          title: "注册电话",
          key: "companyPhone",
          minWidth: 180,
          sortable: false,
        },
        {
          title: "注册地址",
          key: "street",
          minWidth: 180,
          tooltip: true,
        },
        {
          title: "创建时间",
          key: "createTime",
          minWidth: 180,
          sortable: false,
        },
        {
          title: "更新时间",
          key: "createTime",
          minWidth: 180,
          tooltip: true,
        },
        {
          title: "操作",
          slot: "action",
          align: "center",
          fixed: "right",
          width: 140,
        },
      ],
      data: [], // 表单数据
      pageNumber: 1, // 当前页数
      pageSize: 10, // 页面大小
      total: 0, // 表单数据总数
      ////////////////////////  ////////////////////////  ////////////////////////
      cargoName1: "authenticationEnterprise",
      brawerTitle: "承运人认证信息",
      uploadIdCardPic: uploadIdCardPic,
      upLoadCompanyLicense: upLoadCompanyLicense,
      goodsVisible: false,

      idCardIdFormUserIds: {},
      companyLicenseForms: {},
      loadinLicenseInfo: false,
      loadingsubmi: false,
      idCardIdForms: {},
      companyLicenseForm: {
        carryUserId: "", //承运人id
        companyName: "", //公司名称
        companyUserName: "", //法人
        certNo: "", //公司统一社会信用代码
        companyPhone: "", //公司注册电话
        street: "", //通讯地址
        companyPhone: "", //法人电话
        taxSource: "", //税源地

        type: "", //公司类型
        capital: "", //注册资金
        business: "", //经营范围
        startDate: "", //注册时间
        endDate: "", //截止日期
        companyLicenseFileId: "", //公司营业执照图片地址
        //联系人
        contactPhone: "", //联系人 --- 电话
        contactName: "", //联系人 --- 姓名
        //银行信息
        bankCode: "", //开户行账号
        bankName: "", //开户银行
        // 道路运输经营许可证号
        roadPermitNo: "", //道路运输经营许可证号
        roadPermitNoDate: "", //道路运输经营许可证有效期
        roadOperPermitPicFileId: "", //道路经营许可证
        contactName: "",
        contactPhone: "",
      },
      companyForm: {
        companyName: [
          { required: true, message: "请输入公司名称", trigger: "blur" },
        ],
        companyUserName: [
          { required: true, message: "请输入法定代表人", trigger: "blur" },
        ],
        street: [
          { required: true, message: "请输入通讯地址", trigger: "blur" },
        ],
        companyPhone: [
          { required: true, message: "请输入法人电话", trigger: "blur" },
        ],
        taxSource: [
          { required: true, message: "请输入税源地", trigger: "blur" },
        ],
        companyPhone: [
          { required: true, message: "请输入注册电话", trigger: "blur" },
        ],
        certNo: [
          {
            required: true,
            message: "请输入统一社会信用代码",
            trigger: "blur",
          },
        ],
        type: [{ required: true, message: "请输入公司类型", trigger: "blur" }],
        contactName: [
          { required: true, message: "请输入姓名", trigger: "blur" },
        ],
        contactPhone: [
          { required: true, message: "请输入联系电话", trigger: "blur" },
        ],
      },
      //银行信息
      companyLicenseForm3: {
        bankName: "",
        bankCode: "",
        clientId: "", // 民生 - 客户id
        userId: "", //民生 - 操作员号
        userPswd: "", //民生 - 密码
        acntNo: "", //民生 - 账户
        acntName: "", //账户名
      },
      companyForm3: {
        bankName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        bankCode: [
          { required: true, message: "请输入联系电话", trigger: "blur" },
        ],
        clientId: [{ required: true, message: "请输入客户", trigger: "blur" }], // 民生 - 客户id
        userId: [
          { required: true, message: "请输入操作员号", trigger: "blur" },
        ], //民生 - 操作员号

        userPswd: [{ required: true, message: "请输入密码", trigger: "blur" }], //民生 - 密码
        acntNo: [{ required: true, message: "请输入账户", trigger: "blur" }], //民生 - 账户

        acntName: [
          { required: true, message: "请输入账户名", trigger: "blur" },
        ], //账户名
      },
      // 经营许可证
      companyLicenseForm4: {
        roadPermitNo: "",
        roadPermitNoDate: "",
        userName: "", //省厅 - 账号
        password: "", //省厅 - 密码
        iosAppKey: "", //iOSAppSecurity
        androidAppKey: "", //省厅android - appKey
        shengCertNo: "", //统一社会信用代码
      },
      companyForm4: {
        roadPermitNo: [
          {
            required: true,
            message: "请输入道路运输经营许可证号",
            trigger: "blur",
          },
        ],
        roadPermitNoDate: [
          { required: true, message: "请输入联系电话", trigger: "blur" },
        ],
        //
        userName: [
          {
            required: true,
            message: "请输入省厅账号",
            trigger: "blur",
          },
        ], //社会信用代码
        shengCertNo: [
          {
            required: true,
            message: "请输入统一社会信用代码",
            trigger: "blur",
          },
        ],
        password: [
          {
            required: true,
            message: "请输入省厅密码",
            trigger: "blur",
          },
        ], //省厅 - 密码
        iosAppKey: [
          {
            required: true,
            message: "请输入iOS安全码",
            trigger: "blur",
          },
        ], //iOSAppSecurity
        androidAppKey: [
          {
            required: true,
            message: "请输入Android安全码",
            trigger: "blur",
          },
        ], //省厅android - appKey
      },
      // 税务
      companyLicenseForm6: {
        enterpriseCode: "", //税务 - 企业会员号
        enterpriseIdentity: "", //税务后台 - loginSecret
        enterpriseKey: "", //税务后台 - loginKey
        appIdentity: "", //税务APP - identity
        appKey: "", //税务APP - key
      },
      companyForm6: {
        enterpriseCode: [
          { required: true, message: "请输入企业会员号", trigger: "blur" },
        ], //税务 - 企业会员号

        enterpriseIdentity: [
          { required: true, message: "请输入loginSecret", trigger: "blur" },
        ], //税务后台 - loginSecret

        enterpriseKey: [
          { required: true, message: "请输入loginKey", trigger: "blur" },
        ], //税务后台 - loginKey

        appIdentity: [
          { required: true, message: "请输入APPIdentity", trigger: "blur" },
        ], //税务APP - identity

        appKey: [{ required: true, message: "请输入APPKey", trigger: "blur" }], //税务APP - key
      },
      // ETC
      companyLicenseForm7: {
        companyCertificate: "", //ETC - 公司证件号
        companyNumber: "", //ETC - 公司编号
        iv: "", //ETC - 偏移量
        shiboPublicKey: "", //ETC - 公钥
        shiboPrivateKey: "", //ETC - 私钥
      },
      companyForm7: {
        companyCertificate: [
          { required: true, message: "请输入公司证件号", trigger: "blur" },
        ], //ETC - 公司证件号

        companyNumber: [
          { required: true, message: "请输入公司编号", trigger: "blur" },
        ], //ETC - 公司编号

        iv: [{ required: true, message: "请输入偏移量", trigger: "blur" }], //ETC - 偏移量
        shiboPublicKey: [
          { required: true, message: "请输入公钥", trigger: "blur" },
        ], //ETC - 公钥

        shiboPrivateKey: [
          { required: true, message: "请输入私钥", trigger: "blur" },
        ], //ETC - 私钥
      },

      progressBusinessLicen: false, // 营业执照

      companyPicFileUrl: "", // 营业执照
      agreementUrl: "", //授权协议书.
      progressAgreement: false, //授权协议书

      load: 0,
      choice: "",
      addOwnerShow: false,
      // / 操作记录
      operationRecordModal: false,
      operationRecordData: {},
    };
  },
  components: {
    operationRecord,
  },
  methods: {
    // 点击禁用
    frozen(v) {
      if (v.grade == 1) {
        return this.$Message.warning("无法禁用主要公司");
      }
      this.$Modal.confirm({
        title: "确认禁用",
        content: "您确认禁用 " + v.companyName + " 公司吗？",
        loading: true,
        onOk: () => {
          disableEnable({ carryUserId: v.id }).then((res) => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success("操作成功");
              this.getDataList();
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },
    //启用
    Enable(v) {
      this.$Modal.confirm({
        title: "确认启用",
        content: "您确认要启用 " + v.companyName + " ?",
        loading: true,
        onOk: () => {
          disableEnable({ carryUserId: v.id }).then((res) => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success("操作成功");
              this.getDataList();
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },

    // 操作记录点击
    operationRecordClick(row) {
      this.operationRecordModal = true;
      this.operationRecordData.logType = 9;
      this.operationRecordData.oid = row.id;
    },
    // 操作记录关闭
    operationRecordEnd(val) {
      this.operationRecordModal = val;
      this.operationRecordData = {};
    },
    // /设置默认
    setDefault(row) {
      setCarryUserGrade({ carryUserId: row.id }).then((res) => {
        if (res.success) {
          this.$Message.success("设置成功");
          this.getDataList();
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    getAge(value) {
      if (value) {
        let birthdays = new Date(value);
        let d = new Date();
        let age =
          d.getFullYear() -
          birthdays.getFullYear() -
          (d.getMonth() < birthdays.getMonth() ||
          (d.getMonth() == birthdays.getMonth() &&
            d.getDate() < birthdays.getDate())
            ? 1
            : 0);
        return age;
      }
      return "";
    },
    // 新增承运人
    addCargOwner() {
      this.cargoName1 = "authenticationEnterprise";
      this.$refs.companyLicenseForm.resetFields();
      this.$refs.companyLicenseForm3.resetFields();
      this.$refs.companyLicenseForm4.resetFields();
      this.$refs.companyLicenseForm6.resetFields();
      this.$refs.companyLicenseForm7.resetFields();
      this.companyPicFileUrl = ""; // 营业执照
      this.agreementUrl = ""; //授权协议书
      this.goodsVisible = true;
    },
    init() {
      this.getDataList();
    },
    changePage(v) {
      this.searchForm.pageNumber = v;
      this.getDataList();
      this.clearSelectAll();
    },
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.getDataList();
    },
    handleSearch() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 10;
      this.getDataList();
    },
    handleReset() {
      this.$refs.searchForm.resetFields();
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 10;
      this.searchForm.contactPhone = "";
      this.searchForm.companyName = "";
      // 重新加载数据
      this.getDataList();
    },

    // 许可证有效期
    datePermitNoDate(val) {
      this.companyLicenseForm4.roadPermitNoDate = val;
    },
    clearSelectAll() {
      this.$refs.table.selectAll(false);
    },
    getDataList() {
      this.loading = true;
      carryUserList(this.searchForm).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data = res.result.records;
          this.total = res.result.total;
          if (this.data.length == 0 && this.searchForm.pageNumber > 1) {
            this.searchForm.pageNumber -= 1;
            this.getDataList();
          }
        }
      });
    },
    // 删除图片
    handleRemove(file, num) {
      if (num == 1) {
        // 营业执照
        this.companyPicFileUrl = "";
      } else if (num == 6) {
        //委托授权书照片
        this.agreementUrl = "";
      }
    },
    // 图片放大
    handleView(url) {
      let image = new Image();
      image.src = url;
      let viewer = new Viewer(image, {
        hidden: function () {
          viewer.destroy();
        },
      });
      viewer.show();
    },

    // 图片超出指定大小限制时的钩子
    handleMaxSize(file) {
      this.$Message.error("图片超出了最大存储限制");
    },
    //图片格式验证失败时的钩子
    handleFormatError(file) {
      this.$Message.error("图片格式错误,指定上传图片格式 jpg、jpeg、png");
    },
    edit(v) {
      this.$refs.companyLicenseForm.resetFields();
      // this.$refs.companyLicenseForm2.resetFields();
      this.$refs.companyLicenseForm3.resetFields();
      this.$refs.companyLicenseForm4.resetFields();
      this.$refs.companyLicenseForm6.resetFields();
      this.$refs.companyLicenseForm7.resetFields();
      this.cargoName1 = "authenticationEnterprise";
      this.addOwnerShow = true;
      this.goodsVisible = true;
      this.companyPicFileUrl = ""; // 营业执照
      this.agreementUrl = ""; //授权协议书
      this.spinShow = true;
      this.companyLicenseForms = v;
      this.enterpriseCertification(v.id);
      setInterval(() => {
        this.spinShow = false;
      }, 1000);
    },
    // 图片拼接
    imgUrl(val) {
      let url = "";
      if (val) {
        url =
          this.$baseUrl +
          "/freight/file/view/" +
          val +
          "?accessToken=" +
          this.accessToken +
          "&preview=true";
      }
      return url;
    },

    // 企业认证
    enterpriseCertification(carryUserId) {
      getCarryUser({ carryUserId }).then((res) => {
        if (res.success) {
          if (res.result != null) {
            // 企业信息
            this.companyLicenseForm.companyName = res.result.companyName;

            this.companyLicenseForm.companyUserName =
              res.result.companyUserName;

            this.companyLicenseForm.certNo = res.result.certNo;
            this.companyLicenseForm.companyPhone = res.result.companyPhone;

            this.companyLicenseForm.street = res.result.street;

            this.companyLicenseForm.bankCode = res.result.bankCode;

            this.companyLicenseForm.type = res.result.type;
            this.companyLicenseForm.capital = res.result.capital;

            this.companyLicenseForm.business = res.result.business;

            this.companyLicenseForm.startDate = res.result.startDate;

            this.companyLicenseForm.endDate = res.result.endDate;
            this.companyLicenseForm.companyPhone = res.result.companyPhone;
            this.companyLicenseForm.taxSource = res.result.taxSource;

            //联系人
            this.companyLicenseForm.contactPhone = res.result.contactPhone;
            this.companyLicenseForm.contactName = res.result.contactName;
            //银行信息
            this.companyLicenseForm3.bankName = res.result.bankName;
            this.companyLicenseForm3.bankCode = res.result.bankCode;
            // 民生
            this.companyLicenseForm3.clientId = res.result.clientId;

            this.companyLicenseForm3.userId = res.result.userId;

            this.companyLicenseForm3.userPswd = res.result.userPswd;

            this.companyLicenseForm3.acntNo = res.result.acntNo;

            this.companyLicenseForm3.acntName = res.result.acntName;
            // 道路运输经营许可证号
            this.companyLicenseForm4.roadPermitNo = res.result.roadPermitNo;
            this.companyLicenseForm4.roadPermitNoDate =
              res.result.roadPermitNoDate;
            this.companyLicenseForm4.roadOperPermitPicFileId =
              res.result.roadOperPermitPicFileId;

            this.companyLicenseForm4.userName = res.result.userName;
            this.companyLicenseForm4.password = res.result.password;
            this.companyLicenseForm4.iosAppKey = res.result.iosAppKey;
            this.companyLicenseForm4.androidAppKey = res.result.androidAppKey;
            this.companyLicenseForm4.shengCertNo = res.result.shengCertNo;
            // 税务
            this.companyLicenseForm6.enterpriseCode = res.result.enterpriseCode;
            this.companyLicenseForm6.enterpriseIdentity =
              res.result.enterpriseIdentity;
            this.companyLicenseForm6.enterpriseKey = res.result.enterpriseKey;
            this.companyLicenseForm6.appIdentity = res.result.appIdentity;
            this.companyLicenseForm6.appKey = res.result.appKey;
            //ETC
            this.companyLicenseForm7.companyCertificate =
              res.result.companyCertificate;
            this.companyLicenseForm7.companyNumber = res.result.companyNumber;
            this.companyLicenseForm7.shiboPublicKey = res.result.shiboPublicKey;
            this.companyLicenseForm7.shiboPrivateKey =
              res.result.shiboPrivateKey;

            this.companyLicenseForm7.iv = res.result.iv;
            // // 营业执照
            if (res.result.companyLicenseFileId != null) {
              this.companyLicenseForm.companyLicenseFileId =
                res.result.companyLicenseFileId;

              this.companyPicFileUrl = this.imgUrl(
                res.result.companyLicenseFileId
              );
            }
            //委托授权书
            if (res.result.roadOperPermitPicFileId != null) {
              this.companyLicenseForm.roadOperPermitPicFileId =
                res.result.roadOperPermitPicFileId;
              this.agreementUrl = this.imgUrl(
                res.result.roadOperPermitPicFileId
              );
            }
          }
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    // // // v// // // // // // // // // // // // // // // // //
    // 营业执照 企业信息
    BusinessLicen(event, file, fileList) {
      this.progressAll(event, 3);
    },
    // 授权协议书
    AuthorizationAgreement(event, file, fileList) {
      this.progressAll(event, 8);
    },
    // 营业执照
    handleSuccess(res, file, fileList) {
      if (res.code == 500) {
        this.$Message.error(res.message);
        return;
      } else if (res.code == 200) {
        this.$Message.success("上传成功");
        this.form = { ...this.form, ...res.result };
        // this.companyLicenseForm = res.result;
        this.companyLicenseForm.companyName = res.result.companyName;
        this.companyLicenseForm.companyUserName = res.result.companyUserName;
        this.companyLicenseForm.certNo = res.result.certNo;
        this.companyLicenseForm.companyPhone = res.result.companyPhone;
        this.companyLicenseForm.street = res.result.street;

        this.companyLicenseForm.bankCode = res.result.bankCode;
        this.companyLicenseForm.type = res.result.type;
        this.companyLicenseForm.capital = res.result.capital;
        this.companyLicenseForm.business = res.result.business;
        this.companyLicenseForm.startDate = res.result.startDate;
        this.companyLicenseForm.endDate = res.result.endDate;
        this.companyLicenseForm.companyLicenseFileId = res.result.fileId;
        if (this.companyLicenseForm.companyLicenseFileId != null) {
          this.companyPicFileUrl =
            this.$baseUrl +
            "/freight/file/view/" +
            this.companyLicenseForm.companyLicenseFileId +
            "?accessToken=" +
            this.accessToken +
            "&preview=true";
        }
      }
    },

    // 授权协议书
    handleSuccessAgreement(res, file, fileList) {
      if (res.code == 500) {
        this.$Message.error(res.message);
        return;
      } else if (res.code == 200) {
        this.$Message.success("上传成功");
      }
      this.companyLicenseForm.roadOperPermitPicFileId = res.result;
      if (res.result != null) {
        this.agreementUrl =
          this.$baseUrl +
          "/freight/file/view/" +
          res.result +
          "?accessToken=" +
          this.accessToken +
          "&preview=true";
      }
    },
    // 查看图片
    showPic(v) {
      let image = new Image();
      image.src = v;
      let viewer = new Viewer(image, {
        hidden: function () {
          viewer.destroy();
        },
      });
      viewer.show();
    },
    // 进度条
    progressAll(data, num) {
      if (num == 3) {
        this.progressBusinessLicen = true;
      } else if (num == 8) {
        this.progressAgreement = true;
      }

      var CardBack = setTimeout(() => {
        this.load = parseInt(data.percent); // 动态获取文件上传进度
      }, 500); // 一秒后关闭进度条
      setTimeout(() => {
        if (this.load >= 100) {
          this.load = 100;
          setTimeout(() => {
            if (num == 3) {
              this.progressBusinessLicen = false;
            } else if (num == 8) {
              this.progressAgreement = false;
            }
          }, 1000); // 一秒后关闭进度条
          clearTimeout(CardBack);
        }
      }, 501);
    },
    //压缩图片
    beforeUpload(file) {
      return new Promise((resolve, reject) => {
        // console.log("压缩前", file); // 压缩到400KB,大于400KB的图片都会进行压缩，小于则不会
        imageConversion.compressAccurately(file, 100).then((res) => {
          res = new File([res], file.name, {
            type: res.type,
            lastModified: Date.now(),
          });
          resolve(res);
        });
      });
    },

    // 企业认证保存
    submitCompanyLicenseInfo() {
      let form = false;
      let form2 = false;
      let form3 = false;
      let form4 = false;
      let form6 = false;
      let form7 = false;
      //
      this.$refs.companyLicenseForm.validate((valid) => {
        if (valid) {
          form = true;
        } else {
          form = false;
          return this.$Message.error("企业认证资料不完整");
        }
      });
      if (this.companyPicFileUrl == "") {
        return this.$Message.error("请上传营业执照");
      }
      //
      // this.$refs.companyLicenseForm2.validate((valid) => {
      //   if (valid) {
      //     form2 = true;
      //     this.companyLicenseForm.contactName =
      //       this.companyLicenseForm2.contactName;
      //     this.companyLicenseForm.contactPhone =
      //       this.companyLicenseForm2.contactPhone;
      //   } else {
      //     form2 = false;
      //     return this.$Message.error("联系人信息资料不完整");
      //   }
      // });
      //
      this.$refs.companyLicenseForm3.validate((valid) => {
        if (valid) {
          form3 = true;
          this.companyLicenseForm.bankName = this.companyLicenseForm3.bankName;
          this.companyLicenseForm.bankCode = this.companyLicenseForm3.bankCode;

          this.companyLicenseForm.clientId = this.companyLicenseForm3.clientId;
          this.companyLicenseForm.userId = this.companyLicenseForm3.userId;
          this.companyLicenseForm.userPswd = this.companyLicenseForm3.userPswd;
          this.companyLicenseForm.acntNo = this.companyLicenseForm3.acntNo;
          this.companyLicenseForm.acntName = this.companyLicenseForm3.acntName;
        } else {
          form3 = false;
          return this.$Message.error("开户行资料不完整");
        }
      });
      //
      this.$refs.companyLicenseForm4.validate((valid) => {
        if (valid) {
          form4 = true;
          this.companyLicenseForm.roadPermitNo =
            this.companyLicenseForm4.roadPermitNo;
          this.companyLicenseForm.roadPermitNoDate =
            this.companyLicenseForm4.roadPermitNoDate;

          this.companyLicenseForm.userName = this.companyLicenseForm4.userName;

          this.companyLicenseForm.password = this.companyLicenseForm4.password;

          this.companyLicenseForm.iosAppKey =
            this.companyLicenseForm4.iosAppKey;

          this.companyLicenseForm.androidAppKey =
            this.companyLicenseForm4.androidAppKey;

          this.companyLicenseForm.shengCertNo =
            this.companyLicenseForm4.shengCertNo;
        } else {
          form4 = false;
          return this.$Message.error("经营许可证资料不完整");
        }
      });
      if (this.agreementUrl == "") {
        return this.$Message.error("请上传营业执照");
      }
      //驾驶员票
      this.$refs.companyLicenseForm6.validate((valid) => {
        if (valid) {
          form6 = true;
          this.companyLicenseForm.enterpriseCode =
            this.companyLicenseForm6.enterpriseCode; //税务 - 企业会员号

          this.companyLicenseForm.enterpriseIdentity =
            this.companyLicenseForm6.enterpriseIdentity; //税务后台 - loginSecret

          this.companyLicenseForm.enterpriseKey =
            this.companyLicenseForm6.enterpriseKey; //税务后台 - loginKey

          this.companyLicenseForm.appIdentity =
            this.companyLicenseForm6.appIdentity; //税务APP - identity

          this.companyLicenseForm.appKey = this.companyLicenseForm6.appKey; //税务APP - key
        } else {
          form6 = false;
          return this.$Message.error("驾驶员票资料不完整");
        }
      });
      // ETC发票
      this.$refs.companyLicenseForm7.validate((valid) => {
        if (valid) {
          form7 = true;
          this.companyLicenseForm.companyCertificate =
            this.companyLicenseForm7.companyCertificate; //ETC - 公司证件号

          this.companyLicenseForm.companyNumber =
            this.companyLicenseForm7.companyNumber; //ETC - 公司编号

          this.companyLicenseForm.iv = this.companyLicenseForm7.iv; //ETC - 偏移量

          this.companyLicenseForm.shiboPublicKey =
            this.companyLicenseForm7.shiboPublicKey; //ETC - 公司证件号

          this.companyLicenseForm.shiboPrivateKey =
            this.companyLicenseForm7.shiboPrivateKey; //ETC - 公司证件号
        } else {
          form7 = false;
          return this.$Message.error("ETC发票资料不完整");
        }
      });
      if (form && form3 && form4 && form6 && form7) {
        this.$refs.companyLicenseForm.validate((valid) => {
          if (valid) {
            this.loadinLicenseInfo = true;
            this.companyLicenseForms.startDate = this.timeText(
              this.companyLicenseForms.startDate
            );
            this.companyLicenseForms.endDate = this.timeText(
              this.companyLicenseForms.endDate
            );

            for (let item in this.companyLicenseForm) {
              if (!this.companyLicenseForm[item]) {
                delete this.companyLicenseForm[item];
              }
            }
            if (this.companyLicenseForms.id) {
              this.companyLicenseForm.carryUserId = this.companyLicenseForms.id;
            } else {
              this.companyLicenseForm.carryUserId = "";
            }
            saveCarryUser(this.companyLicenseForm).then((res) => {
              this.loadinLicenseInfo = false;
              if (res.success) {
                this.$Message.success("承运人认证信息提交成功");
                this.getDataList();
              } else {
                this.$Message.error(res.message);
              }
            });
          }
        });
      }
    },
    // 时间去横杠
    timeText(val) {
      let text = "";
      if (val) {
        let arr = val.split("");
        arr.forEach((item) => {
          if (item == "-") {
          } else {
            text += item;
          }
        });
      }
      return text;
    },
    // 切换
    cargoTabs(val) {
      if (val == "realNameAuthentication") {
        this.spinShow = true;
        this.nameAuthentication();
        setInterval(() => {
          this.spinShow = false;
        }, 1000);
      } else {
        this.spinShow = true;
        this.enterpriseCertification();
        setInterval(() => {
          this.spinShow = false;
        }, 1000);
      }
    },
    authenticationTabs() {},
    enDrawer(val) {
      this.goodsVisible = true;
      this.$Modal.confirm({
        title: "确认关闭",
        content: "确认关闭？",
        loading: true,
        onOk: () => {
          this.goodsVisible = false;
        },
      });
    },
  },
  mounted() {
    this.init();
    if (localStorage.getItem("jurisdictionCargo") == "ROLE_CargOwner") {
      this.columns = this.columns.filter((col) => col.key !== "action");
    } else {
      this.columns = this.columns;
    }
  },
};
</script>
<style lang="less">
// 建议引入通用样式 具体路径自行修改 可删除下面样式代码
// @import "../../../styles/table-common.less";
.search {
  .operation {
    margin-bottom: 2vh;
  }
  .select-count {
    font-weight: 600;
    color: #40a9ff;
  }
  .select-clear {
    margin-left: 10px;
  }
  .page {
    margin-top: 2vh;
  }
}
.SignedUpload {
  display: flex;
  height: 58px;
  width: 242px;
  margin-left: 10px;
}
.ContractName {
  width: 220px;
  margin-top: -10px;
  margin-left: 31px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  margin-bottom: 10px;
  border: 1px dashed #eee;
  padding: 0 5px;
}
.SigneContractC {
  height: 70px;
}

.agreement {
  position: relative;
  top: -38px;
  left: -7px;
  font-size: 14px;
  margin-left: 63px;
  margin-right: 10px;
}
.CorporateIDCard {
  position: relative;
  top: -38px;
  left: -7px;
  font-size: 14px;
  margin-right: 0px;
  margin-left: 18px;
}
// 图片
.demo-upload-list {
  display: inline-block;
  width: 60px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  margin-right: 4px;
}
.demo-upload-list img {
  width: 60px;
  height: 60px;
}
.demo-upload-list-cover {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
}
.demo-upload-list:hover .demo-upload-list-cover {
  display: block;
}
.demo-upload-list-cover i {
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin: 0 2px;
}
.Signed {
  margin-left: 22px;
  width: 300px;
}
.ListItemcss {
  height: 200px;
  overflow: auto;
  .ivu-list-header {
    font-weight: 700;
    font-size: 15px;
  }
}

.demo-upload-list-company {
  display: inline-block;
  width: 150px;
  height: 90px;
  text-align: center;
  line-height: 60px;
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  margin-right: 4px;
}
.demo-upload-list-company img {
  width: 148px !important;
  height: 88.2px !important;
}
.demo-upload-list-company-cover {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
}
.demo-upload-list-company:hover .demo-upload-list-company-cover {
  display: block;
}
.demo-upload-list-company-cover i {
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin: 0 2px;
  line-height: 90px;
}

//
.check {
  &::before {
    content: "*";
    display: inline-block;
    margin-right: 2px;
    line-height: 1;
    font-family: SimSun;
    font-size: 14px;
    color: #ed4014;
  }
}
.checkdrag {
  &::before {
    content: "*";
    display: inline-block;
    margin-right: 2px;
    line-height: 1;
    font-family: SimSun;
    font-size: 14px;
    color: #ed4014;
    width: 5px;
    margin-left: 5px;
  }
}

.demo-uploadcss-compny {
  margin-top: -13px;
  width: 150px;
  height: 5px;
}
.adoptSubmitId {
  display: flex;
  justify-content: flex-end;
  margin-top: 347px;
}
.Cardokbtn-comy-comy {
  position: relative;
  bottom: 10px;
  left: 0;
  text-align: right;
}
.okbtn-comy {
  z-index: 99999;
  width: 100%;
  margin-top: -15px;
  // background-color: #f5f5f5;
  // border: 1px solid #cdcdcd;
  // height: 70px;
  // line-height: 70px;
}
.demo-drawer-footers-company {
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 10px 16px;
  text-align: right;
  background-color: #f5f5f5;
  border: 1px solid #cdcdcd;
}
.check_font_message {
  font-size: 10px;
  color: #ed4014;
  font-weight: 600;
}
.check_font {
  font-size: 10px;
  font-weight: 600;
}
.Upload-border {
  .ivu-upload-drag {
    border: 0px !important;
  }
}
.information-title {
  margin: 10px 0;
  font-size: 14px;
  font-weight: 600;
}
.information-css {
  margin-top: 30px;
}
</style>
